<?php

namespace Backend\Controller;
use Think\Controller;

class  FinanceController extends  BaseController
{
    public function index() {


        $data =D('Ad_order')->field('sum(amount) as amount,sum(total_amount) as total_amount')->where(array('user_id' =>$_SESSION['id']))->find();
        $data['balance'] =$data['amount'] - $data['total_amount'];
        $this->assign('data',$data);

        $result = D('AdDelivery')->delivery_consum();

        //$result = D('AdDelivery')->field('a.id,a.ad_name as delivery_name,a.use_amount,b.order_name')->join('dsp_ad_order as b on a.order_id = b.id','left')->where(array('user_id' =>$_SESSION['id']))->select();
        $this->assign('result',$result);

        $this->display();
    }
}